package com.example.demo;

import com.google.common.base.Predicates;
import io.swagger.annotations.AuthorizationScope;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.service.Parameter;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;

import java.util.ArrayList;
import java.util.List;
@ComponentScan(basePackages = "com")
@SpringBootApplication
public class DemoApplication {

	public static void main(String[] args) {
		SpringApplication.run(DemoApplication.class, args);
	}
//	@Bean
//	public Docket demoApi() {
//		//添加head参数start
//		ParameterBuilder tokenPar = new ParameterBuilder();
//		List<Parameter> pars = new ArrayList<Parameter>();
//		tokenPar.name("token").description("令牌").modelRef(new ModelRef("string")).parameterType("header").required(false).build();
//		pars.add(tokenPar.build());
//		//添加head参数end
//
//
//		return new Docket(DocumentationType.SWAGGER_2)//<3>
//				.enable(true)
//				.select()//<4>
//				.apis(RequestHandlerSelectors.any())//<5>
//				.paths(Predicates.not(PathSelectors.regex("/error.*")))//<6>, regex must be in double quotes.
//				.build()
//				.globalOperationParameters(pars)
//				.apiInfo(apiInfo());
//	}
//
//
//	private ApiInfo apiInfo() {
//		return new ApiInfoBuilder()
//				.title("后台接口文档与测试")
//				.description("这是一个给app端人员调用server端接口的测试文档与平台")
//				.version("1.0.0")
//				.termsOfServiceUrl("http://terms-of-services.url")
//				//.license("LICENSE")
//				//.licenseUrl("http://url-to-license.com")
//				.build();
//	}




}
